// 导入axios
import axios from 'axios'
export default {
  namespaced: true,
  state: {
    token: '',
    userInfo: {}
  },
  mutations: {
    updateToken(state, payload) {
      state.token = payload
    },
    getUserInfo(state, payload) {
      state.userInfo = payload
    }
  },
  actions: {
    async updateUserInfo(context) {
      const { data: res } = await axios.get('/my/userinfo')
      if (res.code !== 0) return
      context.commit('getUserInfo', res.data)
    }
  },
  getters: {}

}
